package edu.uts.reekie.designer.conceptual.figures;


import org.eclipse.draw2d.*;
import edu.uts.reekie.designer.figures.FigureFactory;
import edu.uts.reekie.designer.model.AbstractConnector;

public class ConcreteFigureFactory implements FigureFactory {


	public PolylineConnection createNewConnector(AbstractConnector c) {
		PolylineConnection conn = new PolylineConnection();
		conn.addRoutingListener(RoutingAnimator.getDefault());
		
		//PolygonDecoration arrow;
		
		// TODO: fix this up for connector orientation and decoration (arrows)
		
		/*
		if (c == null || c.getSource() instanceof SimpleOutput)
			arrow = null;
		else {
			arrow = new PolygonDecoration();
			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
			arrow.setScale(5,2.5);
		}
		conn.setSourceDecoration(arrow);
		
		if (c == null || c.getTarget() instanceof SimpleOutput)
			arrow = null;
		else {
			arrow = new PolygonDecoration();
			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
			arrow.setScale(5,2.5);
		}
		conn.setTargetDecoration(arrow);
		*/
		return conn;
	}
	
	/*
	
	public static PolylineConnection createNewConnector(Connector c) {
		PolylineConnection conn = new PolylineConnection();
		conn.addRoutingListener(RoutingAnimator.getDefault());
		PolygonDecoration arrow;
		
		// TODO: fix this up for connector orientation and decoration (arrows)
		
		if (c == null || c.getSource() instanceof SimpleOutput)
			arrow = null;
		else {
			arrow = new PolygonDecoration();
			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
			arrow.setScale(5,2.5);
		}
		conn.setSourceDecoration(arrow);
		
		if (c == null || c.getTarget() instanceof SimpleOutput)
			arrow = null;
		else {
			arrow = new PolygonDecoration();
			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
			arrow.setScale(5,2.5);
		}
		conn.setTargetDecoration(arrow);
		return conn;
		
*/
	
}
